﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._09_组合模式
{
    /// <summary>
    /// 具体产品
    /// </summary>
    public class Product:IProductComponent
    {
        public string Name { get; }

        public decimal Price { get; }

        public Product(string name,decimal price)
        {
            this.Name = name;
            this.Price = price;
        }

        public void Display(int depth = 0)
        {
            Console.WriteLine($"{new string('-', depth * 2)} 商品：{Name}，价格：{Price }");
        }

        public decimal GetPrice() => Price;
    }
}
